
const mongoose = require("mongoose");

const schema = new mongoose.Schema({//订单集合(orders)
    userId: {//订单从属的用户//买家
        type: mongoose.Schema.Types.ObjectId,
        ref: "users"
    },
    articleId: {//从属的商品id
        type: mongoose.Schema.Types.ObjectId,
        ref: "goods"
    },
    time: String,//订单购买的时间戳   new Date().getTime()
    totle: Number,//总价
    sell: {//卖家的id
        type: mongoose.Schema.Types.ObjectId,
        ref: "users"
    },
    address:String,//收货地址
})
mongoose.model("orders", schema, "orders");